import request from "@/utils/request"

const QuestionApi={
getQuestionPage(queryParams:queryParams){
  return request<any,PageResult<questionType[]>>({
    url:"/api/admin/question/page",
    method:"post",
    data:queryParams
  })
},
// 学科的分页
getsubject(){
return request<any,subjectType[]>({
  url:"/api/admin/education/subject/list",
  method:"post",
})
},
// 题目添加
Questionadd(queryParams:QuestionAddType){
  return request<any,PageResult<questionType[]>>({
    url:"/api/admin/question/edit",
    method:"post",
    data:queryParams
  })
},
getquestionDetaild(id:number){
  return request<any,PageResult<questionType[]>>({
    url:`/api/admin/question/select/`+id,
    method:"post",
  })
},
// 试卷添加
addquestion(queryParams:any){
return request<any,PageResult<null>>({
    url:`/api/admin/exam/paper/edit`,
    method:"post",
    data:queryParams
  })
}

}
export default QuestionApi

export interface queryParams{
   id: null |number
  questionType: null|number
    level: null|number,
    subjectId: null|number,
    pageIndex: number
    pageSize: number
}
export interface questionType{
  id: number,
  questionType: number,  //题型
  textContentId: null|number,
  subjectId: number,  //学科
  createUser: number,  //创建人
  score: string|number, //得分
  status: number,  //状态
  correct: string,  //标答
  analyzeTextContentId: null|number,   //解析
  difficult: number,  //难度
  shortTitle: string  //题干
  createTime: string,  //创建时间
}

// 学科分页返回类型
export interface subjectType{
  name: string,  //学科名称
  level: number,  //年级
  levelName: string,  //年级名称
  itemOrder: null,  //排序
  deleted: boolean  //是否删除
  id: number,  //学科id
}

// 题目添加请求参数
export interface QuestionAddType{
  id: null|number,   //题目id
  questionType: number,  //题型
  subjectId: null|number,  //学科
  title: string,  //题干
  gradeLevel: null|number,  //年级
analyze: string,  //解析
correctArray: null|string[],
correct:string, //正确答案
score: number,  //题目分数
difficult: number,  //难度
items:AnwserType[];
}
export interface AnwserType{
  id?:null|number
  score?:number|null
  itemUuid?:string
  prefix:string
  content:string
}